<!--
 * @Description: 
 * @Author: wanggang
 * @Date: 2019-11-15 18:52:32
 -->
 <!DOCTYPE html>
 <html lang="en">
 <head>
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
     <title>Document</title>
 </head>
 <body>
 </body>
 <script>
     var text = ` <div class="alarm-layer">
         <div class="alarm-tips">
             <div class="tips-img">11</div>
             <div class="tips-name">告警提示</div>
         </div>
         <div class="alarm-content">
             某某某发生告警某某某发生告警某某某发生告警某某某发生告警
         </div>
         <div class="alarm-locate">
             查看详情
         </div>
         <div class="alarm-number">
             还有<span>3</span>个通知
         </div>
         <div class="alarm-layer-page">
             <div class="left_arrows"></div>        
             <div class="middle"><span>1</span>/<span>1</span></div>
             <div class="right_arrows"></div>
         </div>
     </div>`
     function createNode(txt) {
             const template = `<div class='child'>${txt}</div>`;
             let tempNode = document.createElement('div');
             tempNode.innerHTML = template;
             return tempNode.firstChild;
         }
         const container = document.getElementsByTagName("body")[0];
         container.appendChild(createNode(text));


         var head = document.getElementsByTagName("head")[0];
         console.log(head);
         var str = '<link rel="stylesheet" type="text/css" href="全局告警弹窗.css" />';
         head.innerHTML += str;

 </script>
 </html>